
table = {
    1: 'one',
    2: 'two',
    3: 'three',
    4: 'four',
    5: 'five',
    6: 'six',
    7: 'seven',
    8: 'eight',
    9: 'nine',
    10: 'ten',
    11: 'eleven',
    12: 'twelve',
    13: 'thirteen',
    14: 'fourteen',
    15: 'fifteen',
    16: 'sixteen',
    17: 'seventeen',
    18: 'eighteen',
    19: 'nineteen',
    20: 'twenty',
    30: 'thirty',
    40: 'forty',
    50: 'fifty',
    60: 'sixty',
    70: 'seventy',
    80: 'eighty',
    90: 'ninety',
    }
    
    
    

def literal(i):
    s = str(i)
    l = len(s)
    if l == 1:
        return table[i]
    elif l == 2:
        if i in table:
            return table[i]
        else:
            return '%s %s' % (table[int(s[0]) * 10], table[int(s[1])])
    elif l == 3:
        li = '%s hundred' % table[int(s[0])]
        if s[1:] != '00':
            li += ' and %s' % literal(int(s[1:]))
        return li

# print filter(lambda c:c != ' ', literal(42))

c = 0
for i in range(1, 1000):
        c += len(filter(lambda c:c != ' ', literal(i)))
print c